var { getLoginedUser, fnLoading, fnHideLoading, fnSuccess, fnFail } = require('../../utils/index')
import { domainStatic } from '../../utils/env.js';
import _ from '../../utils/underscore.js';

import { get, fnChoose, lsGetStr, fnUpload, post } from '../../utils/request.js';

Component({
  properties: {},
  data: {},
  lifetimes: {
    attached: function () {
    },
    moved: function () {
    },
    detached: function () {
    },
  },
  attached() {
  }, // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready: function () {
  },
  methods: {
    know: function (e) {
      if (e.currentTarget.dataset.id == '14229') {
        var typeId = '980'

      } else {
        var typeId = '981'
      }
      wx.navigateTo({
        url: '../../pages/DetailPags/index?id=' + typeId,

      })
    },
  },

  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show: function () {
      let that = this
      Promise.all([
        get({
          path: '/category1/list?type1=330&isShow=1&sortField=order_num&sortOrder=ASC'
        }),
      ])
        .then(function (res) {
          that.setData({
            other: _.sortBy(res[0].slice(1, 3), 'id'),
          })
        })
        .catch(function (res) {
          fnLoading("请求失败")
        })
    },
  },
})